<?php
/**商品细节表模型
 * @Author: 976123967@qq.com
 * @Date:   2014-08-31 19:09:27
 * @Last Modified by:   chen
 * @Last Modified time: 2014-09-02 23:00:46
 */
class GoodsDetailModel extends Model{
	public $table='goods_detail';



	/**
	 * [add_goods_detail 添加]
	 * @param [type] $gid [description]
	 */
	public function add_goods_detail($gid)
	{
		$goodsServer = $_POST['goods_server'];
		if($goodsServer)
			$goodsServer = serialize($_POST['goods_server']);
		$data = array(
			'goods_id'=>$gid,
			'goods_server'=> $goodsServer,
			'detail'=>$_POST['detail']

		);
		$this->add($data);

	}

	/**
	 * [edit_goods_detail 编辑]
	 * @param [type] $gid [description]
	 */
	public function edit_goods_detail($gid)
	{
		$goodsServer = $_POST['goods_server'];
		if($goodsServer)
			$goodsServer = serialize($_POST['goods_server']);
		$data = array(
			'goods_server'=>$goodsServer,
			'detail'=>$_POST['detail']
		);
		$this->where(array('goods_id'=>$gid))->save($data);

	}
	/**
	 * [del_goods_detail 删除]
	 * @param [type] $gid [description]
	 */
	public function del_goods_detail($gid)
	{
		$this->where(array('goods_id'=>$gid))->delete();

	}
}